package com.dimples.dd.system.convert;

import com.dimples.dd.system.model.bo.RouteBO;
import com.dimples.dd.system.model.entity.SystemMenuDO;
import com.dimples.dd.system.model.form.MenuForm;
import com.dimples.dd.system.model.vo.MenuTreeVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * 角色对象转换器
 *
 * @author zhongyj <1126834403@qq.com><br/>
 * @date 2024/7/3
 */
@Mapper(componentModel = "spring")
public interface MenuConverter {

    SystemMenuDO form2Entity(MenuForm menuForm);

    List<RouteBO> entityList2BoList(List<SystemMenuDO> menuList);

    @Mappings({
            @Mapping(source = "menuName", target = "name"),
            @Mapping(source = "routePath", target = "path"),
            @Mapping(source = "menuType", target = "type")
    })
    RouteBO entity2Bo(SystemMenuDO menu);

    MenuTreeVO entity2Vo(SystemMenuDO entity);
}
